﻿using DevExpress.XtraGrid.Demos.util;
using DXApplicationTangche.DTO;
using mendian;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DXApplicationTangche.UC.工序管理.service
{
    public class 工序Service
    {
        /// <summary>
        /// 获取全部工序
        /// </summary>
        /// <returns></returns>
        public static List<wbsItemDTO> get全部工序(String wbsTemplateId)
        {
            DTO工序管理 DTO工序管理 = FunctionHelper.JsonDeserialization<DTO工序管理>(
                    RestCall.httpGetMethod(
                        URL.接口url + "/project/findWBSTemplateDByIdAndSaveCache?wbsTemplateId=" + wbsTemplateId
                        )
                    );
            return DTO工序管理.wbsItemDTOList;


        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="code"></param>
        /// <returns></returns>
        public static wbsItemDTO get点击单个工序(String code)
        {
            return
                FunctionHelper.JsonDeserialization<wbsItemDTO>(
                    RestCall.httpGetMethod(
                        URL.接口url + "/project/getWBSItemByCode?code=" + code
                        )
                    );
        }
        /// <summary>
        /// 最近两天入库产成品的全部工序记录
        /// </summary>
        /// <returns></returns>
        public static List<StockInWipRecordDTO> getDailyStockInWipRecord()
        {
            return
                FunctionHelper.JsonDeserialization<List<StockInWipRecordDTO>>(
                    RestCall.httpGetMethod(
                        URL.接口url + "/store/getDailyStockInWipRecord"
                        )
                    );
        }
        /// <summary>
        /// 最近两天投产水洗的全部裁剪记录
        /// </summary>
        /// <returns></returns>
        public static List<WashingMarkWipRecodeDTO> getDailyWashingMarkWipRecode()
        {
            return
                FunctionHelper.JsonDeserialization<List<WashingMarkWipRecodeDTO>>(
                    RestCall.httpGetMethod(
                        URL.接口url + "/store/getDailyWashingMarkWipRecode"
                        )
                    );
        }
    }
    
    public class DTO工序管理
    {
        public String id { get; set; }
        public String templateName { get; set; }
        public List<wbsItemDTO> wbsItemDTOList { get; set; } = new List<wbsItemDTO>();
        public DTO工序管理()
        {

        }

    }

    public class wbsItemDTO  //整个工序管理中的每个工序
    {
        public String id { get; set; }
        public String parentId { get; set; }
        public String name { get; set; }
        public String code { get; set; }
        public String index { get; set; }
        public List<achievementTemplateDTO> achievementTemplateDTOS { get; set; } = new List<achievementTemplateDTO>();
        public wbsItemDTO()
        {

        }

    }

    public class achievementTemplateDTO
    {

    }
    
    public class StockInWipRecordDTO
    {
        public String barcode { get; set; }
        public String styleCode { get; set; }
        public String fabricCode { get; set; }
        public String styleSizeCd { get; set; }
        public Boolean semiCheck { get; set; }  //半成品检查
        public Boolean shoufeng { get; set; }   //手缝
        public Boolean dingsuo { get; set; }    //钉锁
        public Boolean garmentCheck { get; set; }   //成品检查
        public StockInWipRecordDTO()
        {

        }
    }
    public class WashingMarkWipRecodeDTO
    {
        public String orderId { get; set; }
        public String orderNo { get; set; }
        public String batchNo { get; set; }
        public String barcode { get; set; }
        public String styleCode { get; set; }
        public String fabricCode { get; set; }
        public String styleSizeCd { get; set; }
        public Boolean caijian { get; set; }   //裁剪
        public WashingMarkWipRecodeDTO()
        {

        }
    }
}
